//*********************************************************
//
//    Copyright (c) Microsoft. All rights reserved.
//    This code is licensed under the Apache License, Version 2.0.
//    THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF
//    ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY
//    IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR
//    PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.
//
//*********************************************************

namespace Microsoft.Research.eResearch.Common.Logging
{
    using System;
    using System.Globalization;

    /// <summary>
    /// Holds the level and message of a log event.
    /// </summary>
    [Serializable]
    public class LogEventArgs : EventArgs
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="LogEventArgs"/> class with the specified message.
        /// In this case the log level is set to a default value of "Debug".
        /// </summary>
        /// <param name="message">The log message.</param>
        public LogEventArgs(string message)
            : this("Debug", message)
        {
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="LogEventArgs"/> class with the specified level and message.
        /// </summary>
        /// <param name="level">The log level.</param>
        /// <param name="message">The log message.</param>
        public LogEventArgs(string level, string message)
        {
            this.Level = level;
            this.Message = message;
        } 

        /// <summary>
        /// Gets the log level.
        /// </summary>
        /// <value>The log level.</value>
        public string Level { get; private set; } 

        /// <summary>
        /// Gets the log message.
        /// </summary>
        /// <value>The log message.</value>
        public string Message { get; private set; } 

        /// <summary>
        /// Returns a <see cref="T:System.String"/> that represents the current <see cref="T:System.Object"/>.
        /// </summary>
        /// <returns>
        /// A <see cref="T:System.String"/> that represents the current <see cref="T:System.Object"/>.
        /// </returns>
        public override string ToString()
        {
            return String.Format(CultureInfo.CurrentUICulture, "[{0}] {1}", this.Level, this.Message);
        } 
    }
}
